00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00052 define("PATH_TO_ROOT", "../");
00054 require_once (PATH_TO_ROOT."common/init.inc.php");
00055 if (isset($_POST['Cancel'])) {
00056 header("Location: ".$_SERVER['PHP_SELF']);
00057 exit;
00058 }
00060 require_once (PATH_TO_ROOT."common/header.inc.php");
00061 include_once "header.inc.php";
00062 writeContentHeader("FotoForum");
00063 include_once "./classes/class.header.inc.php";
00064 if (!isset($action)) {
00065 die("denied.");
00066 }
00067 if ($action == "delete") {
00068 $navpath.= "Post/Thread löschen";
00069 $r_post = forum_query("SELECT postid, userID, posttime FROM forum_post WHERE postid=".$post['postid']);
00070 $post = mysql_fetch_array($r_post);
00071 if (($g_user['userID'] == $post['userID'] && $P->has_permission(P_DELPOST)) || $P->has_permission(P_ODELPOST)) {
00072
00073 if ($config['editlimit'] && !$P->has_permission(P_ODELPOST) && !$P->has_permission(P_NOEDITLIMIT) && ($post['posttime']+$config['editlimit']) < time()) errormessage('Fehler', 'Sie können diesen Post nicht mehr löschen, da das Zeitlimit überschritten wurde.');
00074 if (!isset($do_delete) || !$do_delete) {
00075 $r_thread = forum_query("SELECT threadid, threadreplies FROM forum_thread WHERE threadid=$thread[threadid]");
00076 $thread = mysql_fetch_array($r_thread);
00077 if ($thread['threadreplies'] < 1) {
00078 errormessage(" ", 'Soll dieser Thread wirklich GELÖSCHT werden?<br/><br/>
00079 <form id="theform" method="post" action="'.build_link("threadops.php") .'">
00080 <p class="pForm"><input type="hidden" name="action" value="do_delete"/></p>
00081 <p class="pForm"><input type="hidden" name="thread[threadid]" value="'.$thread['threadid'].'"/></p>
00082 <p class="pForm"><input class="tbbutton" type="submit" name="Submit" value="Löschen >>"/></p>
00083 </form>');
00084 } else {
00085 errormessage("Bestätigung", '
00086 <form id="theform" method="post" action="'.build_link("postops.php") .'">
00087 Möchten Sie diesen Post wirklich löschen?<br/><br/>
00088 <p class="pForm"><input type="hidden" name="do_delete" value="1"/></p>
00089 <p class="pForm"><input type="hidden" name="action" value="delete"/></p>
00090 <p class="pForm"><input type="hidden" name="post[postid]" value="'.$post['postid'].'"/></p>
00091 <p class="pForm"><input class="tbbutton" type="submit" name="Submit" value="Löschen >>"/></p>
00092 </form>');
00093 }
00094 } else {
00095
00096 $post = $_POST['post'];
00097 if (!($post['postid'] = intval($post['postid']))) exit('nix da');
00098
00099 forum_query("UPDATE forum_thread SET threadreplies=threadreplies-1 WHERE threadid=$thread[threadid]");
00100
00101 forum_query("UPDATE forum_board SET boardposts=boardposts-1 WHERE boardid=$board[boardid] AND is_photogallery=1");
00102
00103 RoleArtefacts::deleteItem(FORUM, (int)$post["postid"]);
00104 TeamArtefacts::deleteItem(FORUM, (int)$post["postid"]);
00105
00106
00107
00108
00109 $r_file = forum_query("SELECT
00110 post.postfilename, post.postfilesavename
00111 FROM
00112 forum_post as post
00113 WHERE
00114 postid = $post[postid]");
00115 $file = mysql_fetch_array($r_file);
00116
00117 forum_query("DELETE FROM forum_post WHERE postid = $post[postid]");
00118
00119 forum_query("DELETE FROM photogallery_picquote WHERE postid=$post[postid]");
00120
00121 $courseID = $_SESSION['course'];
00122 $boardID = $board['boardid'];
00123 $uploaddir = PATH_TO_ROOT.$settings["upload_path"]."forum/course/".$courseID."/board/".$boardID."/";
00124 if (is_file($uploaddir.$file['postfilesavename']) && !(@unlink($uploaddir.$file['postfilesavename'])))
00125 {
00126 errormessage("Fehler beim Löschen der Datei!", "Fehler beim Löschen der Datei.<br/><a href=\"".build_link("showtopic.php?threadid=$thread[threadid]") ."\" title='Zurück zum Thread'>Zurück zum Thread</a>");
00127 }
00128
00129
00130 updatethread($thread['threadid']);
00131 updateboard($board['boardid']);
00132 message("Post wurde gelöscht", "Post wurde gelöscht.<br/><a href=\"".build_link("showtopic.php?threadid=$thread[threadid]") ."\" title='Zurück zum Thread'>Zurück zum Thread</a>");
00133 }
00134 } else {
00135 errormessage("Fehler", "Sie haben keine Erlaubnis diesen Post zu löschen");
00136 }
00137 }
00138 include_once "footer.inc.php";
00140 require_once (PATH_TO_ROOT."common/footer.inc.php");
00141 ?>